<?php

namespace app\adminapi\validate;

use app\common\validate\BaseValidate;

class SysFileCateValidate extends BaseValidate
{
    protected $rule = [
        'pageNo' => 'regex:/^([1-9]\d*)$/',
        'pageSize' => ['regex'=>'/^(-1|[1-9]\d*)$/'],
        'id' => 'require|number',
        'type' => 'require|number|in:1,2,3',
        'name' => 'require',
    ];

    protected $message = [
        'pageNo.regex' => '分页页码只能是数字',
        'pageSize.regex' => '分页页大小只能是数字',
        'id.require' => '文件类别参数不完整',
        'id.number' => '文件类别ID类型错误',
        'type.require' => '请输入选择文件类别类型',
        'type.number' => '文件类别类型错误',
        'type.in' => '文件类别类型参数错误',
        'name.require' => '请输入文件类别名称'
    ];

    protected $scene = [
        'list' => ['pageNo', 'pageSize'],
        'insert' => ['type','name'],
        'delete' => ['id'],
        'query' => ['id'],
        'update' => ['id', 'name', 'type']
    ];
}